package com.jzr.bedside.ui.adapter

import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.blankj.utilcode.utils.TimeUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.jzr.bedside.R
import com.jzr.bedside.bean.DrugDataBean


class DrugAdapter(data: MutableList<DrugDataBean>?) :
    BaseQuickAdapter<DrugDataBean, BaseViewHolder>(
        R.layout.item_drug,
        data
    ) {


    override fun convert(helper: BaseViewHolder?, item: DrugDataBean?) {

        val drugChildAdapter = DrugChildAdapter(item?.dataBeanList)
        val rvData = helper?.getView<RecyclerView>(R.id.rv_data)
        val manage = LinearLayoutManager(mContext)
        manage.orientation = LinearLayoutManager.VERTICAL
        rvData?.adapter = drugChildAdapter
        rvData?.layoutManager = manage
        helper?.setText(R.id.tv_date, TimeUtils.millis2String(item?.time?.toLong()!!, "yyyy-MM-dd"))
    }

}
